package tests.mover;

import java.util.Iterator;
import java.util.Timer;
import java.util.TimerTask;

import model.GameStatus;
import model.games.SinglePlayer;
import model.mobs.Mob;
import model.mobsMovers.LinearMover2D;
import model.spawners.Concurrent2DSpawner;

public class TestMover {
	public static void main(String[] args) {
		
		final GameStatus status = new GameStatus();
		Concurrent2DSpawner spawner = new Concurrent2DSpawner(status, 500, 1, 20);
		LinearMover2D mover = new LinearMover2D(status);
		
		SinglePlayer singlePlayer = new SinglePlayer(status, spawner, mover);
		
		
		Timer timer = new Timer();
		timer.scheduleAtFixedRate(new TimerTask(){
			@Override
			public void run() {	
				System.out.println( status.mobsNumber() );
				
				//non va
//				Iterator<Mob> mobs = status.getMobsIterator(false);
//				while ( mobs.hasNext() ) {
//					System.out.println( mobs.next().getCoordinate() );
//				}
				
				
				//va
				Iterator<String> IDs = status.getMobsMapSet().iterator();
				while(IDs.hasNext()){
					Mob mob = status.getMob( IDs.next());
					System.out.println( mob.getCoordinate() );
				}

				
			}
		}, 0, 500);
		
		singlePlayer.start();
		
		
	}
}
